﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcFinalTest.Models.EmployeeModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create Employee
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

<%--<script type="text/javascript">
    Sys.Mvc.ValidatorRegistry.validators["firstname"] = function (rule) {
        // initialization code can go here.
        //var minValue = rule.ValidationParameters["min"];

        // we return the function that actually does the validation 
        return function (value, context) {
            if (value != "") {
                return true; /* success */
            }

            return rule.ErrorMessage;
        };
    };
</script>--%>

    <h2>Create New Employee</h2>
    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm()) {%>
        <%= Html.ValidationSummary() %>

        <fieldset>
            <legend>Create New Employee</legend>
 
            <div class="editor-label">
                <%: Html.Label("First Name") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.FirstName) %>
                <%= Html.ValidationMessageFor(model => model.FirstName,"*") %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Last Name") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.LastName) %>
                <%: Html.ValidationMessageFor(model => model.LastName,"*") %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Email) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Email) %>
                <%: Html.ValidationMessageFor(model => model.Email,"*") %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Address) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Address) %>
                <%: Html.ValidationMessageFor(model => model.Address,"*") %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Branch") %>
            </div>
            <div class="editor-field">
                <%: Html.DropDownList("BranchId") %>
                <%: Html.ValidationMessageFor(model => model.BranchId,"*") %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Job Type") %>
            </div>
            <div class="editor-field">
                <%: Html.DropDownList("JobTypeId") %>
                <%: Html.ValidationMessageFor(model => model.JobTypeId,"*") %>
            </div>
            <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

